<template>
	<page-meta :page-style="'overflow:'+(isScroll?'visible':'hidden')" :scroll-top="pageScrollTop"></page-meta>
	<view style="margin-bottom: 80rpx;background-color: #F5F5F5;padding-bottom: 80rpx;">
		<view class="ConsigneeInfo" v-if="is_virtual">
			<view class="Layout" style="padding: 10px 0;">
				<view @click="checkAdress()" class="InfoBox" v-if="address.city_id">
					<view style="display: flex;align-items: center;">
						<view class="default" v-if="address.is_default=='1'">默认</view>
						<text>{{address.area_info}}</text>
					</view>
					<text style="font-size: 18px;">{{address.address}}</text>
					<text>{{address.true_name}}
						{{address.mob_phone.slice(0, 3) + '****' + address.mob_phone.slice(-4)}}</text>
					<image class="right_arrow" src="../../static/images/right_arrow.png" mode="aspectFit"></image>
				</view>
				<view @click="checkAdress(true)" v-else style="text-align: center;">
					暂无收货地址，点击此处去填写收货地址!
				</view>
			</view>

		</view>

		<view class="" v-if="order_type==4">
			<view class="Layout flexBox">
				<text style="font-weight: bold;color: #000000;"><text class="red">*</text>手机号：</text>
				<input type="number" maxlength="11" v-model="notice_mobile" placeholder="请填写支付尾款通知手机号"
					style="font-size: 26rpx; width: 560rpx;border-bottom: 1rpx solid #EEEEEE;" />
			</view>
		</view>

		<view class="Layout" v-if="order_type==4">
			<view class="" style="font-size: 26rpx;color: #ff4300;">
				预售价￥{{shop_info[0].goods_list[0].yushou_info.goods_price}}元，付定金后再减￥{{shop_info[0].goods_list[0].yushou_info.deduct-shop_info[0].goods_list[0].yushou_info.earnest_money}}元，尾款需付￥{{shop_info[0].goods_list[0].yushou_info.tail_money}}元；(若有优惠，优惠将在付尾款时使用)
			</view>
			<view class="flexBox Deposit" style="color: #D8000F;">
				<view class="name">
					<text
						style="display: inline-block;width: 15rpx;height: 15rpx;background-color: #ff4300;border-radius: 50%;margin:0 10rpx 5rpx;"></text>
					定金
				</view>
				<view class="price">￥{{shop_info[0].goods_list[0].yushou_info.earnest_money}}</view>
			</view>
			<view class="flexBox Deposit">
				<view class="name">
					<text
						style="display: inline-block;width: 15rpx;height: 15rpx;background-color: #666;border-radius: 50%;margin:0 10rpx 5rpx;"></text>
					尾款
				</view>
				<view class="price">￥{{shop_info[0].goods_list[0].yushou_info.tail_money}}</view>
			</view>
			<view class="">{{shop_info[0].goods_list[0].yushou_info.send_date_text}}</view>
			<!-- send_date_text -->

		</view>



		<view v-for="(item,index) in shop_info" :key="index" v-if="shop_info.length">
			<view class="commodityInfo">
				<view class="Layout">
					<view>
						<view class="Title">
							<view class="ShopName">
								<image src="../../static/images/txtp.png" mode=""></image>
								{{item.store_name}}
							</view>
							<view class="Country">
							</view>
						</view>
						<view class="" v-for="(order,index2) in item.goods_list" :key='index2'
							v-if="item.goods_list.length">
							<view class="InfoBox" v-if="!order.bl_goods_list">
								<image :src="order.goods_image_url" mode=""></image>
								<view class="Info">
									<view class="spName">
										{{order.goods_name}}
									</view>
									<view class="spPrice">
										价格：￥{{order.goods_price}}
										<text v-if="order.activity_type" class="zengpin">{{order.activity_type}}</text>
										<view class="ds-flex ft-24">
											<view class="flex_warp">

											</view>
										</view>
									</view>
									<view class="spNum">
										数量：{{order.goods_num}}
									</view>
									<view class="spNum">
										{{order.virtual_name}}
									</view>
								</view>
							</view>

							<!-- 优惠套餐商品展示 -->
							<view class="" v-if="order.bl_goods_list">
								<view class="InfoBox" v-for="(value,index5) in order.bl_goods_list" :key="index5">
									<image :src="value.goods_image_path" mode=""></image>
									<view class="Info">
										<view class="spName">
											{{value.goods_name}}
										</view>
										<view class="spPrice">
											价格：￥{{value.bl_goods_price}}
											<text class="zengpin">优惠套装</text>
											<view class="ds-flex ft-24">
												<view class="flex_warp">

												</view>
											</view>
										</view>
										<view class="spNum">
											数量：{{order.goods_num}}
										</view>
									</view>
								</view>
							</view>

						</view>

						<view v-if="item.goods_list">
							<view v-for="(list,index) in item.goods_list" :key='index'>
								<!-- list.discount_info.full_id -->
								<view v-if="list.gift_list">
									<view class="InfoBox" v-for="(full,index) in list.gift_list" :key="index">
										<image :src="full.gift_goodsimage"></image>
										<view class="Info">
											<view class="spName">
												{{full.gift_goodsname}}
											</view>
											<view class="spPrice">
												价格：￥{{full.gift_price}}
												<text class="active_border">赠品</text>
											</view>
											<view class="spNum">
												数量：{{full.gift_num}}
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>


						<view v-if="item.store_full_activities">
							<view v-for="(list,index) in item.store_full_activities" :key='index'>
								<!-- list.discount_info.full_id -->
								<view v-if="list.discount_info">
									<view class="InfoBox" v-for="(full,index) in list.discount_info.premiums_list"
										:key="index">
										<image :src="full.goods_image_url"></image>
										<view class="Info">
											<view class="spName">
												{{full.goods_name}}
											</view>
											<view class="spPrice">
												价格：￥{{full.goods_price}}
												<text class="active_border">赠品</text>
											</view>
											<view class="spNum">
												数量：{{full.goods_num}}
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>


					<view class="Coupon"
						v-if="store_voucher_list[index].vouchers.length && num==0 && !item.goods_list[0].groupbuy_info && !item.goods_list[0].miaosha_info && order_type!=5"
						@click="open(index)">
						<view class="Coup">优惠券<text
								class="threshold">(可用优惠券{{store_voucher_list[index].vouchers.length}}张)</text></view>
						<view class="threshold">
							<text
								v-if="reduceMoney[index]!=0&&reduceMoney2==0">满{{threshold[index]}}减{{reduceMoney[index]}}</text>
							<image src="../../static/images/right_arrow.png" mode=""
								style="width: 12rpx;height: 20rpx;"></image>
						</view>
					</view>

					<view class="freight">
						<view class="freight_infoBox" @click="openFreightTip(item)">
							运费
							<uni-icons type="info" color="#999999" style="margin-left: 5px;"></uni-icons>
						</view>
						<text>￥{{goods_freight[index]}}</text>
					</view>
					<view class="message">
						<view class="freight_infoBox" style="width: 100px;">
							买家留言
						</view>
						<input type="text" class="messageInput" placeholder="请填写留言信息" placeholder-style="color:#ccc;" v-model="pay_message"  />
					</view>

					<view class="Total" v-if="shop_info.length">
						本店合计：
						<text class="red" style="font-size: 15px;">￥{{store_freight[index]}}</text>
					</view>
				</view>
			</view>
		</view>

		<view class="Layout">
			<view class="Coupon flexBox" @click="ToUserList()" v-if="is_global==1">
				<view class="Coup"><text> 实名认证：</text></view>
				<view class="texthied" style="" v-if="global_userinfo"><text>{{global_userinfo.true_name}}</text>
					<text style="margin-left: 10rpx;" v-if="global_userinfo">{{global_userinfo.id_card}}</text>
				</view>
				<image src="../../static/images/right_arrow.png" mode="" style="width: 12rpx;height: 20rpx;"></image>
			</view>

			<view class="flexBox" style="justify-content: space-between;" v-if="order_type==4">
				<view class="flexBox" style="width: 330rpx;color: #333333;">
					<view class="" style="line-height: 30rpx;font-size: 26rpx;">
						我已同意定金不退等定金协议
					</view>
					<view class="" @click="agreemen()">
						<image style="width: 30rpx;" src="/static/images/wd-2.png" mode="widthFix"></image>
					</view>
				</view>
				<view style="width: 72rpx;transform: scale(0.6);margin-right: 20rpx;" class="fs27">
					<switch color="#4cd964" :checked="check1" @change="switch1Change" />
				</view>
			</view>


			<view class="flexBox2 border2" v-if="orderInfo.is_setup==1">
				<view class="">电商渠道自营商品满{{orderInfo.full_deduction_rule}}立减</view>
				<view class="red">-￥{{orderInfo.full_deduction_rule_dec}}</view>
			</view>


			<view style="border-bottom: 1rpx solid #EEEEEE;padding: 20rpx;" @click="shopmany()"
				v-if="order_type!=5&&order_type!=6&&is_global!=1&&available_shopping_gold">
				<view class="Coupon lin40" style="padding: 0;border: 0;">
					<view class="Coup lin40">积分：</view>
					<view class="texthied lin40" style="">余额
						<text class="red">{{eh_shopping_gold||0}}</text>
						最多可使用<text class="red">{{available_shopping_gold}}</text>
						<text style="font-size: 24rpx;"> (点击使用积分)</text>
					</view>
					<view class="threshold lin40" v-if="!isshopmany">
						<image src="../../static/images/checkno.png" mode=""></image>
					</view>
					<view class="threshold lin40" v-if="isshopmany">
						<image src="../../static/images/checkyes.png" mode=""></image>
					</view>
				</view>
				<view v-if="!isshopmany&&is_member_day" class="lin40"
					style="color: rgb(249, 29, 112);text-align: center;">会员日积分翻倍(最多可50抵100)</view>
				<view v-if="isshopmany&&is_member_day " class="lin40"
					style="color: rgb(249, 29, 112);text-align: center;">
					<text v-if="num==0">会员日积分翻倍 实扣{{actual_shopping_gold}},抵扣{{deduc_shopping_gold}}</text>
					<!--  -->
					<text v-if="num==1">使用会员折扣即不可参加积分翻倍活动</text>
				</view>
			</view>


			<view class="Coupon" @click="integral()" v-if="order_type!=5&&is_global==1&&use_points_num">
				<view class="Coup">积分：</text></view>
				<view class="texthied" style="">可使用<text class="red">{{use_points_num||0}}
					</text> 积分抵扣<text class="red">{{points_exchange_price||0}}</text>元
					<text style="font-size: 24rpx;"> (点击使用积分)</text>
				</view>
				<view class="threshold" v-if="!isintegral">
					<image src="/static/images/checkno.png" mode=""></image>
				</view>
				<view class="threshold" v-if="isintegral">
					<image src="/static/images/checkyes.png" mode=""></image>
				</view>
			</view>


			<view class="Coupon" v-if="has_vipDiscount && order_type!=5&&reduceMoney2==0&&is_global!=1"><!-- -->
				<view class="Coup">会员折扣</view>
				<view class="choice"><text :class="num==1?'Select':''" @click="select(1)">是</text><text
						:class="num==0?'Select':''" @click="select(0)">否</text></view>
			</view>

			<view class="Coupon"
				v-if="platform_voucher_list.length && num==0 && !shop_info[0].goods_list[0].groupbuy_info && !shop_info[0].goods_list[0].miaosha_info && order_type!=5"
				@click="open2()">
				<view class="Coup">平台优惠券<text class="threshold">({{platform_voucher_list.length}})</text></view>
				<view class="threshold">
					<text v-if="reduceMoney2!=0">满{{threshold2}}减{{reduceMoney2}}</text>
					<image src="../../static/images/right_arrow.png" mode="" style="width: 12rpx;height: 20rpx;">
					</image>
				</view>
			</view>
		</view>

		<!-- 选择支付方式 -->
		<view class="buy_box" v-if="ifshow_offpay">
			<view class="buy_title">选择付款方式</view>
			<radio-group @change="chekBuyType">
				<label>
					<radio value="1" :checked="pay_name=='online'" /><text style="margin-right: 20rpx;">线上支付</text>
					<radio value="2" :checked="pay_name=='offline'" /><text>货到付款</text>
				</label>
			</radio-group>
		</view>

		<view class="invoice" v-if="is_vat_deny">
			<view class="Layout">
				<view class="Title">
					开具发票
				</view>
				<radio-group class="draw_bill_radio_group" @change="onSelectDrawBill">
					<label>
						<radio value="1" :checked="num2==1" /><text>不开发票</text>
					</label>
					<label>
						<radio value="2" :checked="num2==2" /><text>开发票 </text>
					</label>
				</radio-group>
			</view>
			<view style="padding:0 0 20rpx 40rpx" v-if="num2==2">
				<radio-group @change="inv_radio">
					<view v-for="(item,index) in inv_List" :key="index" v-if="inv_List.length">
						<view v-if="item.inv_state==2" style="display: inline-block;">
							<label class="radio">
								<radio :value="item.inv_id" :checked="invoice_id==item.inv_id" />
								<text>{{item.inv_title}} <text style="color: #aaa;">--</text>
									{{item.inv_content}}</text>
							</label>
						</view>
						<view v-if="item.inv_state==1" style="display: inline-block;">
							<label class="radio">
								<radio :value="item.inv_id" :checked="invoice_id==item.inv_id" />
								<text>{{item.inv_reg_addr}} <text style="color: #aaa;">--</text>
									{{item.inv_company}}</text>
							</label>
						</view>
						<text class="del_inv" @click="del_inv(item.inv_id)">删除</text>
					</view>
				</radio-group>
				<view v-if="inv_List.length==0">暂无历史发票，请添加！</view>
				<button class="add_inv" @click="inv_opne">添加发票</button>
			</view>
		</view>

		<view class="Settlement"> 
			<view class="Settlement_price" style="margin-left: 40rpx;">
				<text style="font-size: 14px;color: #333333;">订单总额:</text>
				<view class="">
					<view class="red" style="font-size: 19px;text-align: center;height: 22px;line-height: 22px;" >
						<text style="font-size: 14px;">￥</text>
						{{totalSum}}
						</view>
					<view style="color: red;font-size: 11px;">已优惠:<text>￥{{(totalSum - total_price_be_discount).toFixed(2)}}</text></view>
				</view>
			</view>
			<view class="Button" @click="buy2()">
				确认支付
			</view>
		</view>
		<!-- 店铺优惠券弹窗 -->
		<uni-popup ref='popup' type="bottom">
			<view class="popuo_box">
				<scroll-view scroll-y="true" style="height: 600rpx;">
					<view v-for="(item,index) in store_voucher_list" :key="index" v-if="index==currentId">
						<view class="ticket"
							@click="user(ticket.voucher_price,ticket.voucher_limit,ticket.voucher_t_id,ticket.voucher_store_id,index,index2)"
							v-for="(ticket,index2) in item.vouchers" :key="index2">
							<view class="ticketP Cfe0000">{{ticket.voucher_price}}</view>
							<view class="ticketM Cfe0000">满{{ticket.voucher_limit}}可用</view>
							<view class="ticketD Cfe0000">有效期：{{ticket.voucher_end_date|formaDate('yyyy-mm-dd')}}</view>
							<view class="ticketB Cfe0000" v-if="!checkticket[index][index2]">立即使用</view>
							<view class="ticketB Cfe0000" v-if="checkticket[index][index2]">取消使用</view>
						</view>
					</view>
				</scroll-view>

			</view>
		</uni-popup>
		<!-- 平台优惠券弹窗 -->
		<uni-popup ref='popup2' type="bottom">
			<view class="popuo_box">
				<scroll-view scroll-y="true" style="height: 600rpx;">
					<view class="ticket"
						@click="user2(ticket.voucher_price,ticket.voucher_limit,ticket.voucher_t_id,index2)"
						v-for="(ticket,index2) in platform_voucher_list" :key="index2">
						<view class="ticketP Cfe0000">{{ticket.voucher_price}}</view>
						<view class="ticketM Cfe0000">满{{ticket.voucher_limit}}可用</view>
						<view class="ticketD Cfe0000">有效期：{{ticket.voucher_end_date|formaDate('yyyy-mm-dd')}}</view>
						<view class="ticketB Cfe0000" v-if="!checkticket2[index2]">立即使用</view>
						<view class="ticketB Cfe0000" v-if="checkticket2[index2]">取消使用</view>
					</view>
				</scroll-view>

			</view>
		</uni-popup>
		<!-- 发票弹窗 -->
		<uni-popup ref='inv' type="center" :maskClick="false">
			<view class="inv_box">
				<view class="flex_center_center" style="justify-content: space-between;margin-right: 20rpx;">
					<view v-if="ptText=='个人'" class="inv_btn inv_ccc">普通发票</view>
					<view v-if="ptText=='单位'" class="inv_btn inv_ccc">增值税发票</view>
					<view style="border: 2rpx solid #eee;border-radius: 20rpx;padding: 2rpx 20rpx;" :data-num2="1"
						@click="content">关闭</view>
				</view>
				<view v-if="inv_type==1">
					<view class="flex_center">
						<view><text class="red">*</text>发票抬头：</view>
						<picker class="ptPick" mode="selector" :range="ptPicker" @change="selector">
							<view class="" style="display: flex;align-items: center;justify-content: space-between;">
								<text style="margin-left: 20rpx;">{{ptText}}</text>
								<image style="height: 38rpx;width: 38rpx;margin-right: 20rpx;"
									src="../static/images/search_shang_black.png"></image>
							</view>
						</picker>
					</view>
					<view class="">
						<view class="flex_center" v-if="ptText=='个人'">
							<view><text class="red">*</text>个人名称：</view>
							<input v-model="inv_title" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>单位名称：</view>
							<input v-model="inv_title" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>纳税人识别号：</view>
							<input v-model="inv_info.inv_code" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>注册地址：</view>
							<input v-model="inv_info.inv_reg_addr" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>注册电话：</view>
							<input v-model="inv_info.inv_reg_phone" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>开户银行：</view>
							<input v-model="inv_info.inv_reg_bname" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>银行账户：</view>
							<input v-model="inv_info.inv_reg_baccount" type="text">
						</view>
						<view class="flex_center ">
							<view><text class="red">*</text>发票内容：</view>
							<view>{{inv_info.inv_content}}</view>
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>收票人姓名：</view>
							<input v-model="inv_info.inv_rec_name" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>收票人手机号：</view>
							<input v-model="inv_info.inv_rec_mobphone" type="text">
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>收票人省市区：</view>
							<view v-if="pickerText.length==0" @tap="addressOpen()">请选择</view>
							<view v-else @tap="addressOpen()">{{pickerText.join('/')}}</view>
							<simpleAddress themeColor='#333333' cancelColor='#333333' ref="simpleAddress"
								@onConfirm="onConfirm"></simpleAddress>
						</view>
						<view class="flex_center" v-if="ptText=='单位'">
							<view><text class="red">*</text>送票地址：</view>
							<input v-model="inv_info.inv_goto_addr" type="text">
						</view>
					</view>
				</view>
				<view class="flex_center_center" :class="inv_type==1?'btn_box':''">
					<button class="left_btn" @click="keep">保存发票信息</button>
					<button class="right_btn" :data-num2="1" @click="content">不需要发票</button>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref='SetAddress'>
			<view style="border-radius:20rpx;width: 500rpx;background-color: #FFFFFF;overflow: hidden;">
				<view class="Title"
					style="background-color: #ff4300;line-height: 140rpx;text-align: center;color: #FFFFFF;font-size: 36rpx;">
					请设置收货地址</view>
				<view class="ImgBox">
					<image style="width: 100%;" src="/static/images/setaddress.png" mode="widthFix"></image>
				</view>
				<view class="BtnBox flex_bettween">
					<view class="" @click="cancel()">取消</view>
					<view class="" @click="ToAddress()">确认</view>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="agreement">
			<scroll-view scroll-y="true" style="height:800rpx; background-color: #FFFFFF;border-radius: 20rpx;">
				<view style="width: 500rpx;height: 800rpx;padding: 20rpx;" v-html="agreement"></view>
			</scroll-view>
		</uni-popup>
		
		<uni-popup ref="freightTip">
			<view style="display: flex;justify-content: center;align-items: center;flex-direction: column;width: 90vw;">
				<view style="background-color: white;padding: 20px 15px;border-radius: 10px;display: flex;flex-direction: column;align-items: center;">
					<h3 style="margin-bottom: 10px;">运费详情</h3>
					<view style="width: 80vw;" v-for="(item, index) in freightDetailObject.freight_list" :key="index">
						<view style="display: flex;margin-bottom: 10px">
							<text style="flex-grow: 1;">{{freightDetailObject.store_name}}</text>
							<view class="freightTip_info">
								<text>基础运费：￥{{item.base_freight}}</text>
								<text v-if="item.transport_type==2">续重运费：￥{{item.then_freight}}</text>
								<text v-if="item.transport_type==2">重量：{{item.total_num / 1000}}kg</text>
							</view>
						</view>
						
						<image :src="goods.goods_image" mode="aspectFill" style="width: 74px;height: 74px;" v-for="(goods,subIndex) in item.goods_list" :key="subIndex"></image>
						
					</view>
					
					<view class="freightTip_portocol" @click="lookFreightProtocol">
						点击这里查看运费收取规则 
						<uni-icons type="info" color="#999999" style="margin-left: 5px;"></uni-icons>
					</view>
					<text class="freightTip_know" @click="closeFreightIip">我知道了</text>
				</view>
				<uni-icons type="close" color="white" size="40" @click="closeFreightIip"></uni-icons>
			</view>
		</uni-popup>

	</view>
</template>

<script>
	import bestPaymentPassword from '@/mall/components/sanshui-payment-password/index.vue'
	import simpleAddress from '@/components/simple-address/simple-address.nvue'
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	export default {
		components: {
			uniPopup,
			simpleAddress,
			bestPaymentPassword
		},
		data() {
			return {
				TransmittalParameter: {}, //上页传参
				agreement: "",
				check1: false,
				orderInfo: "",
				ptPicker: ['个人', '单位'], //普通picker选择器
				ptText: '个人',
				pickerText: [],
				cityPickerValueDefault: [0, 0, 0],
				discern1: '', //公司名称
				discern2: '', //纳税识别号
				inv_type: 0, //开票类型
				// inv_kind:1,//发票类型
				inv_title: '', //发票抬头内容
				inv_num: "",
				inv_flag: false,
				inv_content: '商品明细',
				invoice_id: 0, //发票信息编号
				num1: 0, //发票抬头
				num2: 1, //发票内容
				num4: true, //会员折扣
				address: [],
				store_id: [],
				cart_id: '',
				order_info: [],
				shop_info: [],
				pay_sn: '',
				ifcart: 0,
				totalSum: 0.00,
				vat_hash: '', //税值发票
				is_global: 0, //全球购标识
				order_type: 1,
				SpellGroup_sn: '',
				store_voucher_list: [], //店铺可使用的优惠券
				voucherFlag: [],
				reduceMoney: [], //代金券减少金额
				reduceMoney2: "", //平台代金券减少金额
				threshold: [], //代金券门槛
				threshold2: "", //平台代金券门槛
				voucherId: [],
				currentId: 0,
				full_money: 0, //满减金额
				ifshow_offpay: false, //是否展示线下支付	
				inv_info: {}, //发票信息
				inv_List: [], //历史发票记录
				is_vat_deny: false, //是否支持发票
				pay_name: 'online', //支付方式默认在线付款
				is_virtual: true, //是否是虚拟订单
				goods_freight: [0.00], //运费
				store_freight: [], //每个店铺的总价
				store_freight1: [],
				store_freight2: [],
				freight_hash: '', //运费hash
				freightDetailObject:{},
				offpay_hash: '',
				offpay_hash_batch: '',
				addressLis: [], //所有收货地址信息
				isshopmany: false, //是否使用积分
				isintegral: false, //是否使用积分
				num: 0, //是否使用会员折扣 0否   1是
				has_vipDiscount: "", //是否有会员折扣
				eh_shopping_gold: "", //积分数量
				available_shopping_gold: "", //可使用积分
				giving_shopping_gold: "", //可获得积分
				reducesum: 0, //使用优惠券总价
				vip_discount_price: "", //会员折扣减少的价格
				notice_mobile: '', //预售尾款通知手机号
				checkticket: [], //优惠券是否已经使用
				checkticket2: [], //平台优惠券是否已经使用
				shopping_gold: "", //最终使用积分
				voucherId2: "",
				Disable: false, //确认按钮是否禁用
				pay_message: "",
				platform_voucher_list: [],
				PTvoucherId: "", //平台优惠券id
				global_userinfo: "", //全球购用户信息
				global_userinfo2: "",
				use_points_num: "", //可使用积分数量
				points_exchange_price: "", //积分抵扣的现金
				bargain_visit_id: "",
				ditch: 0,
				total_price_be_discount: "",
				is_member_day: 0, //是否会员日
				actual_shopping_gold: "",
				available_shopping_gold: "",
				deduc_shopping_gold: "", //会员日抵扣积分金额
				isScroll: true,
				indexs: 1,
				pageScrollTop: '0',
				top: 0,
				sort:''
			}
		},
		onPageScroll(e) {
			if (e.scrollTop) {
				this.top = e.scrollTop + '';
			}
		},
		onShow() {
			setTimeout(() => {
				if (this.TransmittalParameter.ditch) {
					this.ditch = this.TransmittalParameter.ditch
				}
				if (this.TransmittalParameter.bargain_visit_id) {
					this.bargain_visit_id = this.TransmittalParameter.bargain_visit_id
				}
				if (this.TransmittalParameter.SpellGroup_sn) {
					this.SpellGroup_sn = this.TransmittalParameter.SpellGroup_sn
				}
				if (this.TransmittalParameter.is_global) {
					this.is_global = this.TransmittalParameter.is_global
				}
				this.cart_id = this.TransmittalParameter.cart_id
				this.ifcart = this.TransmittalParameter.ifcart
				if (this.TransmittalParameter.order_type) {
					this.order_type = this.TransmittalParameter.order_type
				}
				this.buy1()
				if (this.TransmittalParameter.address && this.TransmittalParameter.address != "undefined") {
					this.address = JSON.parse(decodeURIComponent(this.TransmittalParameter.address))
				}
				if (this.TransmittalParameter.global_userinfo && this.TransmittalParameter.global_userinfo !=
					"undefined") {
					this.global_userinfo = JSON.parse(decodeURIComponent(this.TransmittalParameter
						.global_userinfo));
					this.global_userinfo2 = JSON.parse(decodeURIComponent(this.TransmittalParameter
						.global_userinfo));
				}
				// this.getAddressData()
				// this.buy1()
			}, 100)
		},
		onLoad(e) {
			this.TransmittalParameter = e
			if (e.ditch) {
				this.ditch = e.ditch
			}
			this.getAddressData()
			if (e.bargain_visit_id) {
				this.bargain_visit_id = e.bargain_visit_id
			}
			if (e.sort) {
				this.sort = e.sort
			}
			if (e.SpellGroup_sn) {
				this.SpellGroup_sn = e.SpellGroup_sn
			}
			if (e.is_global) {
				this.is_global = e.is_global
			}
			this.cart_id = e.cart_id
			this.ifcart = e.ifcart
			if (e.order_type) {
				this.order_type = e.order_type
			}
			if (e.global_userinfo && e.global_userinfo != "undefined") {
				this.global_userinfo = JSON.parse(decodeURIComponent(e.global_userinfo));
				this.global_userinfo2 = JSON.parse(decodeURIComponent(e.global_userinfo));
			}
			if (e.address && e.address != "undefined") {
				this.address = JSON.parse(decodeURIComponent(e.address))
				this.$store.commit("fnAddress", this.address)
			} else {
				this.buy1()
			}
		},
		onBackPress() {
			history.back()
			return true;
		},
		methods: {
			agreemen() {
				this.$refs.agreement.open()
				this.$util.request({
					url: '/mobile/index.php?act=document&op=index',
					method: 'get',
					data: {
						did: 10
					},
				}).then(res => {
					this.agreement = res.datas.content
				})

			},
			openFreightTip(store_cart){
				this.$refs.freightTip.open()
				this.getFreightInfo(store_cart)
			},
			closeFreightIip(){
				this.$refs.freightTip.close()
			},
			lookFreightProtocol(){
				uni.navigateTo({
					url: '/member/setting/serve?type=12&title=运费收取规则'
				});
			},
			getFreightInfo(store_cart){
				this.$util.request({
					url: '/mobile/index.php?act=member_buy&op=get_freight_info',
					method: 'post',
					data: {
						freight_hash: this.freight_hash,
						addr_id:this.address.address_id,
						store_id:store_cart.store_id
					},
				}).then(res => {
					this.freightDetailObject = res.datas
				})
			},
			switch1Change(e) {
				this.check1 = e.target.value
			},
			ToUserList() { //实名认证用户
				uni.navigateTo({
					url: '/pagesB/pages/user/List?cart_id=' + this.cart_id + '&ifcart=' + this.ifcart +
						'&is_global=' + this.is_global + '&order_type=' + this.order_type + '&SpellGroup_sn=' +
						this.SpellGroup_sn + "&address=" + encodeURIComponent(JSON.stringify(this.address))
				})
			},
			integral() { //积分使用
				uni.showModal({
					title: '提示',
					content: '是否使用积分！',
					success: (res) => {
						if (res.confirm) {
							if (this.isintegral == false) {
								this.isintegral = true;
								this.totalSum -= Number(this.points_exchange_price)
							} else {
								uni.showToast({
									title: "您已经使用过积分了哦！",
									icon: "none"
								})
							}
						} else if (res.cancel && this.isintegral == true) {
							this.isintegral = false;
							this.totalSum = Number(this.totalSum) + Number(this.points_exchange_price)
						}
						this.totalSum = Number(this.totalSum).toFixed(2)
					}
				});
			},
			shopmany() { //积分使用
				if (this.isshopmany == true) {
					this.isshopmany = false;
					this.totalSum = Number(this.totalSum) + Number(this.shopping_gold)
					this.shopping_gold = 0
					this.totalSum = Number(this.totalSum).toFixed(2)
					return false;
				}
				uni.showModal({
					title: '提示',
					content: '使用积分后将不再赠送积分！',
					success: (res) => {
						if (res.confirm) {
							if (this.isshopmany == false) {

								if (this.num == 1) {
									this.shopping_gold = this.available_shopping_gold
								} else {
									this.shopping_gold = this.deduc_shopping_gold ? this.deduc_shopping_gold :
										this.available_shopping_gold
								}
								this.isshopmany = true;
								this.totalSum -= Number(this.shopping_gold)
								// this.totalSum-= Number(this.available_shopping_gold)

							} else {
								uni.showToast({
									title: "您已经使用过积分了哦！",
									icon: "none"
								})
							}

						} else if (res.cancel) {

						}
						this.totalSum = Number(this.totalSum).toFixed(2)
					}
				});
			},
			select(index) { //是否使用会员折扣
				if (this.reduceMoney2) {
					uni.showToast({
						title: "会员折扣和代金券不能同时使用",
						icon: "none"
					})
					return false
				}
				if (index != this.num) {
					this.num = index;
					if (this.num == 1) {
						this.totalSum = (Number(this.totalSum) + Number(this.reducesum)).toFixed(2)
						if (this.vip_discount_price) {
							this.totalSum = Number(this.totalSum) - Number(this.vip_discount_price);
							this.voucherId2 = this.voucherId
							this.voucherId = []
						}
						if (this.isshopmany && this.is_member_day) { //会员日积分价格
							this.totalSum = Number(this.totalSum) + Number(this.deduc_shopping_gold) - Number(this
								.available_shopping_gold);
						}
						if (this.reduceMoney2) {
							this.totalSum = Number(this.totalSum) - Number(this.vip_discount_price) - Number(this
								.reduceMoney2);
						}
						this.store_freight2 = this.store_freight
						this.store_freight = this.store_freight1
					} else if (this.num == 0) {
						this.totalSum = (Number(this.totalSum) - Number(this.reducesum)).toFixed(2)
						if (this.vip_discount_price) {
							this.totalSum = Number(this.totalSum) + Number(this.vip_discount_price);
							this.voucherId = this.voucherId2
						}
						if (this.isshopmany && this.is_member_day) { //会员日积分价格
							this.totalSum = Number(this.totalSum) - Number(this.deduc_shopping_gold) + Number(this
								.available_shopping_gold);
						}
						if (this.reduceMoney2) {
							this.totalSum = Number(this.totalSum) + Number(this.vip_discount_price) + Number(this
								.reduceMoney2);
						}
						this.store_freight = this.store_freight2
					}
				}
				this.totalSum = this.totalSum.toFixed(2)

			},
			//获取收货地址信息
			getAddressData() {
				this.$util.request({
					url: '/mobile/index.php?act=member_address&op=address_list',
					method: 'post',
					data: {},
				}).then(res => {
					this.addressLis = res.datas.address_list
				})
			},
			//切换收货地址
			changeAddress() {
				this.$util.request({
					url: '/mobile/index.php?act=member_buy&op=change_address',
					method: 'POST',
					data: {
						freight_hash: this.freight_hash,
						addr_id: this.address.address_id,
						city_id: this.address.city_id,
						area_id: this.address.area_id
					}
				}).then(res => {
					this.offpay_hash_batch = res.datas.offpay_hash_batch
					this.offpay_hash = res.datas.offpay_hash
					for (let i = 0; i < this.shop_info.length; i++) {
						this.goods_freight.splice(i, 1, 0.00)
						for (let key in res.datas.content) {
							let free = (Number(this.goods_freight[i]) + Number(res.datas.content[key])).toFixed(2)
							this.goods_freight.splice(i, 1, free)
						}
						//店铺总价
						this.store_freight.splice(i, 1, (Number(this.shop_info[i].store_goods_total) + Number(this
							.goods_freight[i])).toFixed(2))
						this.store_freight1.splice(i, 1, (Number(this.shop_info[i].store_goods_total) + Number(this
							.goods_freight[i])).toFixed(2))
						//订单总价
						for (let j = 0; j < this.goods_freight.length; j++) {
							this.totalSum = (Number(this.totalSum) + Number(this.goods_freight[j])).toFixed(2)
						}
					}
				})
				// this.store_freight1=this.store_freight
			},
			//普通发票个人,单位pickerchange 时间
			selector(e) {
				this.ptText = this.ptPicker[e.detail.value]
				this.inv_title = ""
				this.indexs = parseInt(e.detail.value) + 1
			},
			//保存并使用发票信息
			keep() {
				//验证
				console.log("this.indexs", this.indexs)
				if (this.indexs == 2) {
					if (this.checkNa()) {
						this.inv_flag = true
						this.invoice()
					}
				}
				if (this.indexs == 1) {
					if (this.inv_title == '') {
						uni.showToast({
							title: '个人名称不能为空！',
							icon: 'none'
						})
						return false
					} else {
						let reg = /^[\u4E00-\u9FA5]{2,10}(·[\u4E00-\u9FA5]{2,10}){0,2}$/
						if (!reg.test(this.inv_title)) {
							uni.showToast({
								title: '请输入正确的个人名称！',
								icon: 'none'
							})
							return false
						}
					}
					this.inv_flag = true
					this.invoice()
				}
			},
			//打开省市区选择
			addressOpen() {
				this.cityPickerValueDefault = [0, 0, 0]
				this.$refs.simpleAddress.open()
			},
			//选择省市区
			onConfirm(e) {
				this.pickerText = e.labelArr
				this.inv_info.inv_rec_province = e.labelArr.join('|')
			},
			//切换购买方式
			chekBuyType(e) {
				if (e.detail.value == 1) {
					this.pay_name = 'online'
				} else {
					this.pay_name = 'offline'
				}
			},
			//使用优惠券
			user(reduceMoney, threshold, t_id, s_id, index, index2) {

				if (this.reduceMoney2 || this.num) {
					uni.showToast({
						title: "优惠券和会员折扣不能同时使用",
						icon: "none"
					})
					return false
				}
				let id = t_id + ',' + s_id + ',' + reduceMoney
				if (this.store_id[index] != s_id) {
					//不是同一个店铺直接使用
					this.store_id.splice(index, 1, s_id)
					this.voucherId.splice(index, 1, id.replace(/,/g, '|'))
					this.reduceMoney.splice(index, 1, reduceMoney)
					this.threshold.splice(index, 1, threshold)
					for (let i = 0; i < this.checkticket[index].length; i++) {
						this.checkticket[index][i] = false
						if (i == index2) {
							this.checkticket[index][i] = true
						}
					}
					this.store_freight[index] = (Number(this.store_freight[index]) - Number(this.reduceMoney[index]))
						.toFixed(2) //店铺总价
					this.reducesum += Number(reduceMoney) //使用优惠券总价
					this.totalSum = (Number(this.totalSum) - Number(this.reduceMoney[index]) + Number(this.reduceMoney2))
						.toFixed(2) //订单总价
				} else {
					if (id.replace(/,/g, '|') == this.voucherId[index]) {
						//如果是同一个店铺使用同一个优惠券则取消使用
						this.reducesum -= Number(reduceMoney) //使用优惠券总价
						this.store_freight[index] = (Number(this.store_freight[index]) + Number(this.reduceMoney[index]))
							.toFixed(2) //店铺总价
						this.totalSum = (Number(this.totalSum) + Number(reduceMoney) - Number(this.reduceMoney2)).toFixed(
							2) //订单总价
						this.reduceMoney.splice(index, 1, 0)
						this.threshold.splice(index, 1, 0)
						this.voucherId.splice(index, 1, 0)
						this.store_id.splice(index, 1, '')
						for (let i = 0; i < this.checkticket[index].length; i++) {
							this.checkticket[index][i] = false
						}
					} else {
						//如果是不同的优惠券则替换

						this.totalSum = (Number(this.totalSum) + Number(this.reduceMoney[index]) - Number(reduceMoney))
							.toFixed(2)
						this.store_freight[index] = this.store_freight[index] + Number(this.reduceMoney[index]) - Number(
							reduceMoney).toFixed(2) //店铺总价
						this.reducesum = this.reducesum + Number(this.reduceMoney[index]) - Number(reduceMoney) //使用优惠券总价
						this.reduceMoney.splice(index, 1, reduceMoney)
						this.threshold.splice(index, 1, threshold)
						this.voucherId.splice(index, 1, id.replace(/,/g, '|'))

						for (let i = 0; i < this.checkticket[index].length; i++) {
							this.checkticket[index][i] = false
							if (i == index2) {
								this.checkticket[index][i] = true
							}
						}
					}
				}
				this.$refs.popup.close()
			},

			user2(reduceMoney, threshold, t_id, index2) { //平台优惠券
				if (this.vip_discount_price == undefined) {
					this.vip_discount_price = 0
				}
				let id = t_id + ',' + "platform" + ',' + reduceMoney
				if (id.replace(/,/g, '|') == this.PTvoucherId) {
					//取消
					//如果是同一个优惠券则取消使用	+平台优惠券金额	—优惠券总金额 		-会员折扣
					this.totalSum = (Number(this.totalSum) + Number(reduceMoney) - Number(this.reducesum) - Number(this
						.vip_discount_price)).toFixed(2) //订单总价
					this.reduceMoney2 = 0 //使用平台优惠券总价
					this.threshold2 = 0
					this.PTvoucherId = 0
					for (let i = 0; i < this.checkticket2.length; i++) {
						this.checkticket2[index2] = false
					}
				} else {
					//添加
					if (this.reduceMoney2) {
						this.totalSum = (Number(this.totalSum) + Number(this.reduceMoney2) - Number(reduceMoney)).toFixed(
							2) //订单总价
					} else {
						this.totalSum = (Number(this.totalSum) + Number(this.reduceMoney2) - Number(reduceMoney) + Number(
							this.reducesum) + Number(this.vip_discount_price)).toFixed(2) //订单总价
					}
					this.reduceMoney2 = Number(reduceMoney) //使用平台优惠券总价
					this.threshold2 = threshold
					this.PTvoucherId = id.replace(/,/g, '|')
					for (let i = 0; i < this.checkticket2.length; i++) {
						this.checkticket2[i] = false
						if (i == index2) {
							this.checkticket2[index2] = true
						}
					}
				}
				this.$refs.popup2.close()
			},
			//打开优惠券
			open(index) {
				if (this.store_voucher_list[index].vouchers.length) {
					this.currentId = index
					this.$refs.popup.open()
				} else {
					uni.showToast({
						title: '没有符合的优惠券！',
						icon: 'none'
					})
				}

			},
			open2() {
				if (this.platform_voucher_list.length) {
					this.$refs.popup2.open()
				} else {
					uni.showToast({
						title: '没有符合的优惠券！',
						icon: 'none'
					})
				}

			},
			//去选择地址
			checkAdress(state) {
				uni.navigateTo({
					url: '/member/address/list?path=confirmation&cart_id=' + this.cart_id +
						'&ifcart=' + this.ifcart + '&is_global=' + this.is_global + '&order_type=' + this
						.order_type +
						'&SpellGroup_sn=' + this.SpellGroup_sn + "&global_userinfo=" + encodeURIComponent(JSON
							.stringify(this.global_userinfo))
				})
			},
			cancel() {
				this.$refs.SetAddress.close()
			},
			ToAddress() {
				this.$refs.SetAddress.close()
				uni.navigateTo({
					url: '/member/address/add?path=confirmation&cart_id=' + this.cart_id +
						'&ifcart=' + this.ifcart + '&is_global=' + this.is_global + '&order_type=' + this
						.order_type +
						'&SpellGroup_sn=' + this.SpellGroup_sn + "&state=true"
				})
			},
			//购买第一步
			buy1() {
				let url = ''
				if (this.TransmittalParameter.is_virtual == 1) {
					url = '/mobile/index.php?act=member_vr_buy&op=buy_step1'
				} else {
					url = '/mobile/index.php?act=member_buy&op=buy_step1'
				}
				this.$util.request({
					url: url,
					method: 'POST',
					data: {
						cart_id: this.cart_id,
						ifcart: this.ifcart,
						is_global: this.is_global,
						order_type: this.order_type,
						SpellGroup_sn: this.SpellGroup_sn,
						bargain_visit_id: this.bargain_visit_id,
						ditch: this.ditch || 0,
						sort:this.sort
					}
				}).then(res => {
					if (res.message == "该商品您有进行中的拼团订单") {
						uni.showToast({
							title: '您已有该商品拼团记录！',
							icon: 'none'
						})
						setTimeout(() => {
							uni.redirectTo({
								url: '/operation/spellGroup/record'
							})

						}, 1000)
						return false
					}
					if (res.error_code != 0) {
						uni.showToast({
							title: res.message,
							icon: 'none',
							success() {
								setTimeout(() => {
									uni.navigateBack({
										duration: 1
									})
								}, 1000)
							}
						})
						return false
					}
					//初始化总价
					this.goods_freight = [0.00] //运费
					this.totalSum = 0 //订单总价
					this.is_member_day = res.datas.is_member_day
					this.actual_shopping_gold = res.datas.actual_shopping_gold
					this.freight_hash = res.datas.freight_hash //运费
					this.is_vat_deny = res.datas.is_vat_deny //增值税发票
					this.is_global = res.datas.is_global //是否全球购
					this.ifshow_offpay = res.datas.ifshow_offpay //是否支持货到付款
					this.has_vipDiscount = res.datas.has_vipDiscount //是否支持会员折扣
					this.eh_shopping_gold = res.datas.eh_shopping_gold ? parseInt(res.datas.eh_shopping_gold) :
						0 //积分数量

					this.deduc_shopping_gold = res.datas.deduc_shopping_gold //会员日抵扣积分金额
					this.available_shopping_gold = res.datas.available_shopping_gold //可使用积分
					this.giving_shopping_gold = res.datas.giving_shopping_gold //可获得积分
					this.vip_discount_price = res.datas.vip_discount_price //会员折扣减少的价格
					this.orderInfo = res.datas; //订单信息
					this.total_price_be_discount = res.datas.total_price_be_discount //订单未优惠前价格
					if (this.global_userinfo2) {
						this.global_userinfo = this.global_userinfo2
					} else {
						this.global_userinfo = res.datas.global_userinfo //全球购用户信息
					}
					this.use_points_num = res.datas.use_points_num //积分数量
					this.points_exchange_price = res.datas.points_exchange_price //积分抵扣现金

					this.platform_voucher_list = res.datas.platform_voucher_list //平台优惠券
					if (this.platform_voucher_list) {
						this.platform_voucher_list.map((item) => {
							this.checkticket2.push(false)
						})
					}

					//获取发票信息
					if (res.datas.inv_info.content == '不需要发票' | res.datas.inv_info.title == null) {
						this.inv_info.title = ""
						this.inv_info.inv_code = ""
						this.inv_info.inv_reg_addr = ""
						this.inv_info.inv_reg_phone = ""
						this.inv_info.inv_reg_bname = ""
						this.inv_info.inv_reg_baccount = ""
						this.inv_info.inv_content = "商品明细"
						this.inv_info.inv_rec_name = ""
						this.inv_info.inv_rec_mobphone = ""
						this.inv_info.inv_rec_province = ""
						this.inv_info.inv_goto_addr = ""
					} else {
						this.inv_info = res.datas.inv_info
					}
					//获取历史发票信息
					this.inv_history()
					if (!res.datas.address_info.city_id) {
						this.$refs.SetAddress.open()
					}
					// //判断是否自己去选择地址
					// if(this.address.length==0){
					// 	this.address=res.datas.address_info
					// 	console.log(555555555,this.address.area_info)
					// }else{
					// 	if(res.datas.address_info.hasOwnProperty('null')){
					// 		this.address=[]
					// 	}else{
					// 		this.address=res.datas.address_info
					// 		//判断之前选择的地址是否被删除掉了
					// 		let flag=true
					// 		for(let i =0;i<this.addressLis.length;i++){
					// 			if(this.address.address_id==this.addressLis[i].address_id){
					// 				flag=false
					// 			}
					// 		}
					// 		if(flag){
					// 			this.address=res.datas.address_info
					// 			console.log(44444444444,this.address.area_info)
					// 		}
					// 	}
					// }
					if (this.$store.state.order_address != '') {
						this.address = this.$store.state.order_address
					} else {
						this.address = res.datas.address_info
					}

					this.shop_info = res.datas.store_cart_list //店铺信息
					this.vat_hash = res.datas.vat_hash //增值税发票
					this.changeAddress()
					for (let i = 0; i < this.shop_info.length; i++) {
						this.totalSum = (Number(this.totalSum) + Number(this.shop_info[i].store_goods_total))
							.toFixed(2)

						// this.goods_freight.splice(i,1,0.00)
						// this.shop_info[i].goods_list.map(item=>{
						// 	if(item.goods_freight){
						// 		let free=(Number(this.goods_freight[i])+Number(item.goods_freight)).toFixed(2)
						// 		this.goods_freight.splice(i,1,free)
						// 	}
						// })


					}
					if (this.orderInfo.is_setup == 1) { //自营商品立减
						this.totalSum = (Number(this.totalSum) - Number(this.orderInfo.full_deduction_rule_dec))
							.toFixed(2)
					}
					//优惠券列表
					this.store_voucher_list = res.datas.store_voucher_list
					if (res.datas.store_voucher_list) {
						for (let i = 0; i < this.store_voucher_list.length; i++) {
							this.store_id.push('')
							this.reduceMoney.push(0)
							this.threshold.push(0)
							this.voucherId.push(0)
							this.checkticket.push([])
							this.store_voucher_list[i].vouchers.map((item, index) => {
								this.checkticket[i].push(false)
							})
						}
					}

				})

			},
			//购买第二步
			buy2() {
				if (this.order_type == 4 && !this.check1) {
					uni.showToast({
						title: "请同意预售协议",
						icon: "none"
					})
					return false
				}
				uni.showLoading({})

				if (!this.global_userinfo && this.is_global == 1) {
					uni.showToast({
						title: "实名信息不能为空",
						icon: "none"
					})
				}
				if (this.inv_type != 0) {
					if (this.invoice_id == '') {
						uni.showToast({
							title: '请选择发票信息！',
							icon: 'none'
						})
						return false
					}
				} else {
					this.inv_info.invoice_id = ''
				}
				//获取使用的优惠券
				let voucher = ''
				this.voucherId.map((item, index) => {
					if (item != '') {
						if (index > 0) {
							voucher = voucher + ',' + item
						} else {
							voucher = item
						}
					}
				})
				if (this.Disable) {
					return false;
				}
				this.Disable = true
				this.$util.request({
					url: '/mobile/index.php?act=member_buy&op=buy_step2',
					method: 'POST',
					data: {
						cart_id: this.cart_id,
						ifcart: this.ifcart,
						address_id: this.address.address_id,
						vat_hash: this.vat_hash,
						is_global: this.is_global,
						order_type: this.order_type,
						SpellGroup_sn: this.SpellGroup_sn,
						invoice_id: this.inv_info.invoice_id,
						offpay_hash: this.offpay_hash,
						offpay_hash_batch: this.offpay_hash_batch,
						pd_pay: 0,
						pay_name: this.pay_name,
						notice_mobile: this.notice_mobile,
						shopping_gold: this.shopping_gold,
						use_vip_discount: this.num,
						voucher: voucher,
						pay_message: this.pay_message,
						pvoucher: this.PTvoucherId,
						gid: this.global_userinfo ? this.global_userinfo.gid : "",
						platform_points: this.isintegral ? this.use_points_num : "",
						bargain_visit_id: this.bargain_visit_id,
						ditch: this.ditch || 0,
						sort:this.sort,
						comm_id: uni.getStorageSync("InvitationCode") || 0
					}
				}).then(res => {
					this.Disable = false
					uni.hideLoading()
					if (res.error_code == 0) {
						this.pay_sn = res.datas.pay_sn
						if (this.order_type == 2) {
							if (this.SpellGroup_sn == '') {
								uni.redirectTo({
									url: '/plug/pay/cashier?pay_sn=' + this.pay_sn + '&moeny=' + this
										.totalSum + '&type=2&SpellGroup_sn=' + this.SpellGroup_sn
								})
							} else {
								uni.redirectTo({
									url: '/plug/pay/cashier?pay_sn=' + this.pay_sn + '&moeny=' + this
										.totalSum + '&type=2&SpellGroup_sn=' + this.SpellGroup_sn
								})
							}
						} else {
							if (this.pay_name == 'online') {
								uni.redirectTo({
									url: '/plug/pay/cashier?pay_sn=' + this.pay_sn + '&moeny=' + this
										.totalSum + '&order_sn='
								})
							} else if (this.pay_name == 'offline') {
								uni.redirectTo({
									url: '/member/order/AllOrder'
								})
							}

						}
					} else {
						if (res.message == "请选择收货地址") {
							this.$refs.SetAddress.open()
							// uni.showModal({
							// 		title:'提示',
							// 		content:'您还没有收货地址是否前往添加？',
							// 		success: (res2) => {
							// 			if(res2.confirm){	
							// 				// uni.redirectTo({
							// 				// 	url:'../../pages/car/address?path=confirmation&cart_id='+this.cart_id+
							// 				// 	'&ifcart='+this.ifcart+'&is_global='+this.is_global+'&order_type='+this.order_type+
							// 				// 	'&SpellGroup_sn='+this.SpellGroup_sn
							// 				// })	
							// 			}else if(res2.cancel){
							// 				console.log("取消")
							// 			}
							// 		}
							// 	})
						} else {
							uni.showToast({
								title: res.message,
								icon: 'none'
							})
						}
					}
				})
			},

			//发票信息添加
			invoice() {
				let data = {}
				if (this.ptText == '单位') {
					this.inv_info.inv_type = 1
					this.inv_info.inv_title = this.inv_title
					this.inv_info.inv_content = this.inv_content
					data = this.inv_info
				} else {
					if (!this.inv_flag) {
						return false
					}
					data = {}
					this.inv_info.inv_type = 2
					data.inv_title = this.inv_title //发票抬头
					data.inv_content = this.inv_content //发票内容
					data.inv_type = this.inv_info.inv_type //开票类型
				}
				console.log(data)
				this.$util.request({
					url: '/mobile/index.php?act=member_invoice&op=invoice_add',
					method: 'POST',
					data
				}).then(res => {
					this.invoice_id = res.datas.inv_id
					if (res.error_code == 0) {
						uni.showToast({
							title: '添加成功！'
						})
						//初始化数据
						this.inv_info = {}
						this.inv_info.inv_title = ""
						this.inv_info.inv_code = ""
						this.inv_info.inv_reg_addr = ""
						this.inv_info.inv_reg_phone = ""
						this.inv_info.inv_reg_bname = ""
						this.inv_info.inv_reg_baccount = ""
						this.inv_info.inv_content = "商品明细"
						this.inv_info.inv_rec_name = ""
						this.inv_info.inv_rec_mobphone = ""
						this.inv_info.inv_rec_province = ""
						this.inv_info.inv_goto_addr = ""
						this.inv_history()
						this.isScroll = true
						this.pageScrollTop = this.top
						this.ptText = "个人"
						this.$refs.inv.close()
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						})
					}
				})
			},
			//增值税发票验证表单
			checkNa() {
				//验证公司名称
				if (this.inv_info.inv_company == '') {
					uni.showToast({
						title: '请输入公司名称！',
						icon: 'none'
					})
					return false
				}
				//验证纳税号
				if (this.inv_info.inv_code == '') {
					uni.showToast({
						title: '请输入纳税号！',
						icon: 'none'
					})
					return false
				} else {
					let reg = /^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/
					if (!reg.test(this.inv_info.inv_code)) {
						uni.showToast({
							title: '请输入正确的纳税号！',
							icon: 'none'
						})
						return false
					}
				}
				//验证注册地址
				if (this.inv_info.inv_reg_addr == '') {
					uni.showToast({
						title: '请输入注册地址!',
						icon: 'none'
					})
					return false
				}
				if (this.inv_info.inv_reg_phone == '') {
					uni.showToast({
						title: '请输入注册电话！',
						icon: 'none'
					})
					return false
				} else {
					let reg = /^1[3456789]\d{9}$/
					if (!reg.test(this.inv_info.inv_reg_phone)) {
						uni.showToast({
							title: '请输入正确的电话号码！',
							icon: 'none'
						})
						return false
					}
				}
				if (this.inv_info.inv_reg_bname == '') {
					uni.showToast({
						title: '请填写开户银行！',
						icon: 'none'
					})
					return false
				} else {
					let reg = /\p{Unified_Ideograph}/u
					if (!reg.test(this.inv_info.inv_reg_bname)) {
						uni.showToast({
							title: '请填写正确的开户银行',
							icon: 'none'
						})
						return false
					}
				}
				if (this.inv_info.inv_reg_baccount == '') {
					uni.showToast({
						title: '请填写开户银行账号！',
						icon: 'none'
					})
					return false
				} else {
					if (!/^\d{16}|\d{19}$/.test(this.inv_info.inv_reg_baccount) & !/^\d{4}(?:\s\d{4}){3}$/.test(this
							.inv_info.inv_reg_baccount)) {
						uni.showToast({
							title: '请填写正确的银行卡账号！',
							icon: 'none'
						})
						return false
					}
				}
				if (this.inv_info.inv_rec_name == '') {
					uni.showToast({
						title: '请填写收票人姓名！',
						icon: 'none'
					})
					return false
				}
				if (this.inv_info.inv_rec_mobphone == '') {
					uni.showToast({
						title: '请填写收票人手机号！',
						icon: 'none'
					})
					return false
				} else {
					let reg = /^1[3456789]\d{9}$/
					if (!reg.test(this.inv_info.inv_rec_mobphone)) {
						uni.showToast({
							title: '请输入正确的手机号码！',
							icon: 'none'
						})
						return false
					}
				}
				if (this.inv_info.inv_rec_province == '') {
					uni.showToast({
						title: '请选择收票人省市区',
						icon: 'none'
					})
				}
				if (this.inv_info.inv_goto_addr == '') {
					uni.showToast({
						title: '请填写送票地址！',
						icon: 'none'
					})
					return false
				}
				this.inv_flag = true
				this.isScroll = true
				this.pageScrollTop = this.top
				this.ptText = '个人'
				this.$refs.inv.close()
				return true
			},
			//选择历史发票信息
			inv_radio(e) {
				this.invoice_id = e.detail.value
				this.inv_info.invoice_id = this.invoice_id
			},
			onSelectDrawBill(e) {
				this.isScroll = true
				this.num2 = e.detail.value
				this.$refs.inv.close()
				this.inv_type = this.num2
				this.ptText = '个人'
				if (this.num2 == 1) {
					this.inv_type = 0
				} else {
					this.inv_type = 1
				}
			},
			//删除历史发票
			del_inv(id) {
				this.$util.request({
					url: '/mobile/index.php?act=member_invoice&op=invoice_del',
					method: 'POST',
					data: {
						inv_id: id
					}
				}).then(res => {
					console.log(res)
					if (res.error_code == 0) {
						this.inv_history()
						uni.showToast({
							title: '删除成功！'
						})
					}
				})
			},
			//获取发票历史记录
			inv_history() {
				this.$util.request({
					url: '/mobile/index.php?act=member_invoice&op=invoice_list',
					data: {
						pagesize: 10
					}
				}).then(res => {
					this.inv_List = res.datas.invoice_list
				})
			},
			//打开填写发票popup
			inv_opne() {
				this.isScroll = false
				this.pageScrollTop = '0'
				this.$refs.inv.open()
			},
			// rise(e){
			// 	this.num2=2
			// 	this.num1= e.currentTarget.dataset.num1;

			// 	if(e.currentTarget.dataset.num1==1){
			// 		this.inv_type=this.num1
			// 		this.inv_title='单位'
			// 	}else{
			// 		this.inv_type=this.num1
			// 		this.inv_title='个人'
			// 	}
			// 	// console.log(e.currentTarget.dataset.num1,this.inv_type,this.inv_title)
			//  },
			content(e) {
				console.log(e)
				this.isScroll = true
				this.$refs.inv.close()
				this.num2 = e.currentTarget.dataset.num2;
				this.inv_type = e.currentTarget.dataset.num2
				this.ptText = '个人'
				if (e.currentTarget.dataset.num2 == 1) {
					this.inv_type = 0
				} else {
					this.inv_type = 1
				}
			},
			//    radio2(e){
			// 	this.num4= e.currentTarget.dataset.num4;
			// },
		},
		onBackPress(e) {
			uni.switchTab({
				url: '/main/cart/list'
			});
			return true
		},
	}
</script>

<style lang="scss">
	.Deposit view {}

	.Deposit .name {
		text-align: center;
		width: 40%;
	}
	
	.freightTip_know {
		width: 150px;
		height: 30px;
		border: 1px solid #707070;
		border-radius: 15px;
		text-align: center;
		line-height: 30px;
	}
	.freightTip_portocol {
		display: flex;
		align-items: center;
		color: #999999;
		align-self: flex-start;
		margin-bottom: 20px;
	}
	.freightTip_info {
		display: flex;
		flex-direction: column;
	}

	.Deposit .price {
		text-align: right;
		width: 60%;
		margin-right: 20rpx;
	}

	.border2 {
		border-top: 1rpx solid #EEEEEE;
		border-bottom: 1rpx solid #EEEEEE;
	}

	.BtnBox {
		padding: 20rpx 45rpx;
	}

	.BtnBox>view {
		width: 190rpx;
		line-height: 60rpx;
		border-radius: 30rpx;
		text-align: center;
		background: #ff4300;
		color: #FFFFFF;
		/* margin: 20rpx 30rpx; */
	}

	.flex_bettween {
		display: flex;
		justify-content: space-between;
	}

	.texthied {
		width: 510rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.flexBox {
		display: flex;
		align-items: center;
	}

	.flexBox2 {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.Coupon .choice text {
		background-color: #CCCCCC;
		padding: 5rpx 20rpx;
		color: #FFFFFF;
		margin-left: 20rpx;
		border-radius: 10rpx;
	}

	.Select {
		background-color: #ff4300 !important;
	}

	.active_border {
		color: #DE2362;
		background: linear-gradient(to right, #F46476, #ff4300);
		border-radius: 10rpx;
		color: #FFFFFF;
		padding: 5rpx 20rpx;
		font-size: 26rpx;
		margin-left: 20rpx;
	}

	.del_inv {
		color: #D93600;
	}

	.add_inv {
		width: 200rpx;
		font-size: 26rpx;
		margin: 20rpx 0 0px 0px;
		background-color: #ff4300;
		color: #ffffff;
	}

	.ptPick {
		border: 1px solid #eee;
		text-align: center;
		border-radius: 5px;
	}

	.btn_box {
		margin-top: 200rpx;
		width: 100%;
	}

	.left_btn {
		margin-left: 20rpx;
		font-size: 26rpx;
		background-color: #fe4300;
		color: #FFFFFF;
	}

	.right_btn {
		margin-right: 20rpx;
		font-size: 26rpx;
		background-color: #F5F5F5;
		color: #666666;
	}

	.flex_center input {
		border: 1rpx solid #EEEEEE;
		font-size: 26rpx;
		padding: 8rpx 15rpx;
	}

	.flex_center view:first-child {
		width: 212rpx;
		font-size: 26rpx;
	}

	.red {
		color: red;
	}

	.flex_center {
		padding: 16rpx 0 16rpx 20rpx;
		display: flex;
		align-items: center;
	}

	.inv_box {
		width: 620rpx;
		background-color: #FFFFFF;
		position: relative;
		padding: 10rpx 0 80rpx;
		height: 700rpx;
		border-radius: 20rpx;
		overflow-y: auto;
	}

	.inv_btn {
		border: 1rpx solid #eee;
		border-radius: 10px;
		font-size: 13px;
		padding: 2rpx 20rpx;
		margin: 10rpx 20rpx;
	}

	.inv_ccc {
		background-color: #fe4300;
		color: #FFFFFF;
	}

	.flex_center_center {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	/deep/.uni-radio-input {
		height: 34rpx;
		width: 34rpx;
	}

	/deep/.uni-radio-input-checked {
		background-color: #ff4300 !important;
		border-color: #ff4300 !important;
	}

	.uni-label-pointer {
		font-size: 30rpx;
		color: #333333;
	}

	.buy_box {
		padding: 10rpx 40rpx 20rpx;
		background-color: #ffffff;
		margin-top: 20rpx;
	}

	.buy_title {
		font-size: 30rpx;
		color: #333333;
		font-weight: bold;
		margin-bottom: 10rpx;
	}

	.shuiwu {
		display: flex;
		align-items: center;
		padding: 0 40rpx 20rpx;
		color: #333333;
	}

	.first {
		width: 30%;
		text-align: left;
	}

	.company_input {
		border: 1rpx solid #eeeeee;
		margin: 0 20rpx;
		padding: 6rpx 20rpx;
		width: 60%;
		font-size: 26rpx;
	}

	.popuo_box {
		height: 600rpx;
		background-color: #FFFFFF;
		border-top-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
		padding: 20rpx;
	}

	.ticket {
		position: relative;
		width: 710upx;
		height: 230rpx;
		background: url(../static/images/ticket.jpg) no-repeat;
		background-size: 100% 230rpx;
	}

	.ticket .ticketBg {

		width: 710upx;
		height: 232upx;
		position: absolute;
		left: 0;
		top: 0;
		z-index: -1;
	}

	.ticketP {
		position: absolute;
		font-size: 98upx;
		left: 93upx;
		top: 13upx;
		font-weight: bold;
	}

	.ticketM {
		position: absolute;
		font-size: 22upx;
		left: 313upx;
		top: 103upx;
	}

	.ticketD {
		position: absolute;
		font-size: 24upx;
		left: 153upx;
		top: 148upx;
	}

	.ticketB {
		width: 146upx;
		height: 62upx;
		line-height: 62upx;
		text-align: center;
		position: absolute;
		font-size: 22upx;
		left: 543upx;
		top: 83upx;
		background-color: #fff;
		color: #ff4300;
		border-radius: 31upx;
	}

	.ticketH {
		width: 100upx;
		height: 100upx;
		position: absolute;
		left: 570upx;
		top: 63upx;
		z-index: 10;
	}

	.floatRig {
		float: right;
	}

	.method {
		border-bottom: 1rpx solid #EEEEEE;
	}

	.method .Name {
		color: #000000;
		font-weight: bolder;
		margin: 20rpx 0;
	}

	.method .List {
		display: flex;
		line-height: 40rpx;
		margin-bottom: 20rpx;
	}

	.method .List .option {
		margin-right: 30rpx;
		color: #000000;
		display: flex;
	}

	.curr3 .radio {
		background-color: #ff4300 !important;
	}

	.method .List .option .radio {
		width: 40rpx;
		height: 40rpx;
		background-color: #969595;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.method .List .option .radio view {
		width: 20rpx;
		height: 20rpx;
		margin: 10rpx;
		background-color: #ffffff;
		border-radius: 50%;

	}

	.freight {
		color: #666;
		padding: 10px 10px 0;
		font-weight: bolder;
		display: flex;
		align-items: center;
	}

	.freight_infoBox {
		width: 80px;
		color: #333;
		font-weight: normal;
	}

	.freight text {
		color: #ff4300;
		font-weight: 500;
	}

	.Amount {
		color: #000000;
		font-weight: bolder;
		border-bottom: 1rpx solid #EEEEEE;
		padding: 15rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.Amount text {
		color: #ff4300;
	}

	.Amount .Inf {
		font-size: 18rpx;
		font-weight: 500;
		color: #999999;
		width: 360rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.bgeee {
		background-color: #EEEEEE;
	}

	.Amount image {
		float: right;
		width: 12rpx;
		height: 20rpx;
		margin-top: 10rpx;
	}

	.VIPDiscount {
		display: flex;
		justify-content: space-between;
		color: #000000;
		font-weight: bolder;
		padding: 15rpx;
		border-bottom: 1rpx solid #EEEEEE;
	}

	.VIPDiscount .Whether {
		display: flex;

	}

	.VIPDiscount .Whether .Choice {
		margin-right: 20rpx;
		background-color: #999999;
		font-weight: 500;
		color: #FFFFFF;
		padding: 0 20rpx;
		border-radius: 10rpx;
	}

	.Total .Tips {
		font-size: 14px;
		color: #999999;
	}

	.Total {
		font-size: 14px;
		color: #333;
		text-align: right;
		padding: 10px;
	}

	.red {
		color: #ff4300;
	}

	.Authentication {
		background-color: #FFFFFF;
		margin-top: 20rpx;
		padding: 15rpx;
	}

	.Authentication .Layout {
		display: flex;
		align-items: center;
	}

	.draw_bill_radio_group {
		margin: 10px 10px 0;
		padding-bottom: 10px;
	}

	.Authentication text {
		color: #000000;
		font-weight: bolder;
	}

	.Authentication input {
		font-size: 18rpx;
		border-bottom: 1rpx solid #EEEEEE;
		width: 520rpx;
	}

	.curr4 {
		background-color: #ff4300 !important;
	}

	.Layout {
		box-sizing: border-box;
	}

	.ConsigneeInfo {
		background-color: #FFFFFF;
		font-size: 24rpx;
		color: #000000;
		margin: 10px;
		border-radius: 6px;
		position: relative;
	}

	.ConsigneeInfo .InfoBox {
		padding: 0 10px;
		display: flex;
		flex-direction: column;
		position: relative;
	}

	.Info {
		width: 580rpx;
	}

	.spName {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 5;
		overflow: hidden;
		height: 80rpx;
		line-height: 40rpx;
	}

	.ConsigneeInfo .InfoBox .right_arrow {
		width: 12rpx;
		height: 100%;
		position: absolute;
		right: 10px;
	}

	.ConsigneeInfo .InfoBox .default {
		background-color: #ff4300;
		color: #FFFFFF;
		padding: 0 6px;
		height: 20px;
		line-height: 20px;
		font-size: 13px;
		border-radius: 6px;
		margin-right: 6px;
	}

	.Texthide {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.commodityInfo {
		margin: 10px;
		background-color: #FFFFFF;
		border-radius: 6px;
	}

	.commodityInfo .Title {
		padding: 10px;
		display: flex;
		justify-content: space-between;
		border-bottom: 2rpx solid #EEEEEE;
		font-size: 30rpx;
		color: #333;
	}

	.commodityInfo .Country {
		font-weight: 500;
		color: #ff4300;
	}

	.commodityInfo .Country image {
		width: 10rpx;
		height: 10rpx;
		vertical-align: middle;
		margin-right: 10rpx;
	}

	.commodityInfo .ShopName image {
		width: 58rpx;
		height: 58rpx;
		vertical-align: middle;
		margin-right: 20rpx;
	}

	.commodityInfo .InfoBox {
		padding: 20rpx;
		border-bottom: 2rpx solid #EEEEEE;
		display: flex;
		align-items: center;
		color: #666666;
		font-size: 24rpx;
	}

	.commodityInfo .InfoBox>image {
		width: 160rpx;
		height: 160rpx;
	}

	.commodityInfo .InfoBox .Info {
		margin-left: 30rpx;
	}

	.Coupon {
		display: flex;
		justify-content: space-between;
		padding: 15rpx;
		background-color: white;
		margin: 10px;
		border-radius: 6px;
	}

	.Coupon .Coup {
		color: #333;
	}

	.Coupon .threshold {
		color: #ff4300;
	}

	.Coupon image {
		width: 35rpx;
		height: 35rpx;
		margin-left: 15rpx;
	}

	.message {
		padding: 0 10px;
		color: #000000;
		font-weight: bolder;
		border-bottom: 0.5px solid #EEEEEE;
		display: flex;
		align-items: center;
	}

	.invoice {
		background-color: #FFFFFF;
		margin-top: 20rpx;
		padding-bottom: 20rpx;
		margin: 10px 10px 60px;
		border-radius: 6px;
	}

	.invoice {
		background-color: #FFFFFF;
		margin-top: 20rpx;
		padding-bottom: env(safe-area-inset-bottom);
	}

	.invoice .Title {
		color: #333;
		border-bottom: 2rpx solid #EEEEEE;
		padding: 10px;
	}

	.invoice .rise {
		color: #333333;
		padding: 20rpx;
		margin-top: 20rpx;
	}

	.invoice .rise view {
		display: inline-block;
		border: 1rpx solid #EEEEEE;
		margin: 0 20rpx;
		width: 170rpx;
		text-align: center;
		color: #666666;
		position: relative;
	}

	.invoice view image {
		display: none;
	}

	.invoice .curr image {
		position: absolute;
		bottom: 0;
		right: 0;
		width: 50rpx;
		height: 50rpx;
		display: block;
	}

	.curr {
		border: 1rpx solid #ff4300 !important;
	}

	.invoice .content {
		margin: 0;
		padding-bottom: 20rpx !important;
	}

	.Settlement {
		background-color: #FFFFFF;
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		display: flex;
		justify-content: space-between;
		font-size: 30rpx;
		color: #000000;
		padding-top: 10px;
		padding-bottom: constant(safe-area-inset-bottom);
		/*兼容 IOS<11.2*/
		padding-bottom: env(safe-area-inset-bottom);
	}
	.Settlement_price {
		display: flex;
		
	}

	.Settlement .Total {
		margin-left: 60rpx;
	}

	.Settlement .Total text {
		color: #ff4300;
		line-height: 80rpx;
	}

	.Settlement .Button {
		width: 150px;
		height: 40px;
		background-color: #ff4300;
		color: #FFFFFF;
		line-height: 40px;
		border-radius: 20px;
		text-align: center;
		/* margin: 10px; */
		margin-bottom: 10px;
		margin-right: 10px;
	}

	.messageInput {
		padding: 0 10rpx;
		color: #333333;
		font-size: 14px;
		width: 100%;
		box-sizing: border-box;
		height: 40px;
		flex-grow: 1;
		font-weight: normal;
	}

	.zengpin {
		background-color: #ff4300;
		padding: 5rpx 10rpx;
		border-radius: 10rpx;
		color: #FFFFFF;
		margin-left: 20rpx;
	}

	.lin40 {
		line-height: 30rpx;
	}
</style>